const { getArgsMap } = require('@lhy-assist/node')
const production = require('./production')

module.exports = (processEnv, profile) => {
  console.log(`\n================================\n`)
  console.log(`using profile: ${profile}`)
  console.log(`\n================================\n`)
  let configEnv = {}
  if (profile && profile !== 'production') {
    configEnv = require(`./${profile}`)
  }
  const config = Object.assign({}, processEnv, production, configEnv)
  getArgsMap().forEach((value, key) => {
    config[key] = value
  })
  return config
}
